#ifndef BOARDFIGURE_H
#define BOARDFIGURE_H

#include <QPoint>
#include <QObject>

#include "boarditem.h"
#include "move.h"
#include "constants.h"

class BoardFigure : public BoardItem
{
public:
  BoardFigure( int, int, QString, int, QGraphicsItem* parent = 0 );
  static bool isFieldUnderAttackByColor(int, int, int, BoardFigure* [8][8] );
  virtual bool isMovable();
  virtual QList<Move*>& getPossibleMoves( BoardFigure* [8][8] ) = 0;
  virtual QList<QPoint*>& getAttackedFields( BoardFigure* [8][8] );
  int getColor() { return color; };
  void move( int, int, BoardFigure* [8][8] );
  void clearPossibleMoves();
  void clearAttackedFields();
  int getMoveCount() { return moveCount; };
  ~BoardFigure();

protected:
  virtual int getDefaultZValue();
  bool checkNewPos( int, int );
  QList<Move*> possibleMoves;
  QList<QPoint*> attackedFields;
  void generateMovesFromVectors( int*, int*, int, BoardFigure* [8][8] );
  bool possibleMovesReady;
  bool attackedFieldsReady;

private:
  int color;
  int moveCount;

};

#endif
